﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace OnlineCooperation
{
    /// <summary>
    /// TeamFileDelFolder 的摘要说明
    /// </summary>
    public class TeamFileDelFolder : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["CurrentDir"] == null || context.Session["CurrentDir"].ToString() == "")
                return;

            String dir = context.Session["CurrentDir"].ToString();

            context.Response.ContentType = "text/plain";


            // Delete a directory and all subdirectories with Directory static method...
            if (System.IO.Directory.Exists(dir))
            {
                try
                {
                    System.IO.Directory.Delete(dir, true);
                    //context.Response.Write(dir);
                }

                catch (System.IO.IOException e)
                {
                    context.Response.Write(e.Message);
                }
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}